import com.github.pagehelper.PageHelper;
import com.hp.dao.LinkDao;
import com.hp.entity.Link;
import com.hp.service.LinkService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

//@RunWith(JUnit4ClassRunner.class)
//@ContextConfiguration("classpath:bean.xml")
public class Springtext {

    @Test
    public void test01(){
        //org.apache.ibatis.binding.MapperProxy@589da3f3 代理 解耦
        ApplicationContext ac= new ClassPathXmlApplicationContext("bean.xml");
        LinkDao bean = ac.getBean(LinkDao.class);
        try {
            PageHelper.startPage(1,5);
            List<Link> findAll = bean.findAll();
            for (Link link : findAll) {
                System.out.println(link.getId());
            }
//            LinkService linkService= ac.getBean(LinkService.class);
//            List<Link> links=linkService.findAll();
//            for (Link link : links){
//                System.out.println(link.getLinkName());
//            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}

